I get `System.Web.UI.WebControls.TextBox` instead of TextBox value

Posted by Anna T on Stack Overflow See other posts from Stack Overflow or by Anna T
Published on 2012-06-19T03:09:53Z Indexed on 2012/06/19 3:16 UTC
Read the original article Hit count: 159

Filed under:
|
|

Gooday. Could you help me figure out please why I get this: System.Web.UI.WebControls.TextBox on Label1:

DataListItem item = DataList1.Items[0];
TextBox nume = (TextBox)item.FindControl("numeTb");
Label1.Text = nume.ToString();

I specify that the numeTb element is put like this in the ASPX file:

<asp:TextBox ID="numeTb" runat="server" Width="400px" 
Text='<%# Eval("nume") %>' DataTextField="nume" DataValueField="nume"></asp:TextBox>

I just added the DataTextField bits thinking might help, but no. Thank you!

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET